package com.shiguo365.market.display.activity;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;

import com.shiguo365.market.R;
import com.shiguo365.market.display.base.BaseActivity;
import com.shiguo365.market.display.util.ToolsUtils;

public class WelcomeActivity extends BaseActivity {
    private static final String TAG = "WelcomeActivity";
    private Integer UID=0;
    private Activity activity;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);

        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏

        activity=this;
        new Handler().postDelayed(new Runnable() {
            public void run() {

                SharedPreferences preferences=getSharedPreferences("data", Context.MODE_PRIVATE);
                UID=preferences.getInt("uid",0);
                Log.d(TAG,UID.toString());

                if(UID>0){
                    Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
                    startActivity(intent);
                    finish();
                }else{
                    Intent intent = new Intent(WelcomeActivity.this, LoginActivity.class);
                    startActivity(intent);
                    finish();
                }

            }
        }, 1000);

    }
}
